home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2002 #11
/
Amiga Plus CD - 2002 - No. 11.iso
/
Tools
/
AmigaSystem
/
Scalos
/
StackWindow_plugin
/
StackWindows.e
next >
Wrap
Text File
|
2002-10-28
|
2KB
|
83 lines
OPT PREPROCESS
LIBRARY 'stackwindows.plugin',1,0,'$VER: stackwindows.plugin 1.0 (11.08.2001)' IS stackWindows(A0,A1)
MODULE 'scalos/scalos','intuition/intuition','intuition/intuitionbase','intuition/screens','amigaini','libraries/amigainibase'
PROC stackWindows(wt:PTR TO scaWindowTask,i:PTR TO scaIconNode)
DEF w=0:PTR TO window,x=0,y=15,xi=15,yi=15,
ib:PTR TO intuitionbase,mx,my,ai=0:PTR TO amigaini
/* Check for amigaini lib and load attempt to load settings */
IF (amigainibase:=OpenLibrary(AMIGAININAME,AMIGAINI_VMIN))<>NIL
ai:=InitINI('ENV:Scalos/StackWindows.ini')
ai:=ReadINI(ai)
IF ai.error=0
FindGroupINI(ai,'INITIAL')
x:=GetIntINI(x,ai,'LEFT',0)
y:=GetIntINI(y,ai,'TOP',15)
FindGroupINI(ai,'INCREMENT')
xi:=GetIntINI(xi,ai,'MOVE RIGHT',15)
yi:=GetIntINI(yi,ai,'MOVE DOWN',15)
FreeINI(ai)
ENDIF
CloseLibrary(amigainibase)
ai:=0
ENDIF
/* get a pointer to intuitionbase */
ib:=intuitionbase
Forbid() -> forbid acces while we mess around
/* get screen size */
mx:=ib.activescreen::screen.width
my:=ib.activescreen::screen.height
/* get apointer to the passed window structure */
w:=wt.window
/* see if multiple windows are open and cycle back to the first one */
IF w.parent THEN WHILE w.parent DO w:=w.parent
/* Now cycle through the window list in the right order */
w:=w.descendant
WHILE w.descendant<>NIL
IF StrLen(w.title)<>0 -> window has title text
stack(w,x,y,mx,my) -> Stack the window
x:=x+xi
y:=y+yi
ENDIF
IF w.descendant THEN w:=w.descendant
ENDWHILE
Permit()
ENDPROC
PROC stack(w:PTR TO window,x,y,mx,my); DEF dx,dy,dw=0,dh=0
dx:=(0-w.leftedge)+x
dy:=(0-w.topedge)+y
IF (w.width+x) > mx
dw:=mx-(w.width+x)
ENDIF
IF (w.height+y) > my
dh:=my-(w.height+y)
ENDIF
IF (dw) OR (dh) THEN SizeWindow(w,dw,dh)
MoveWindow(w,dx,dy)
WindowToFront(w)
ActivateWindow(w)
ENDPROC
PROC main() IS EMPTY